package com.pointstar.dp.modules.project.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.pointstar.dp.common.annotation.SysLog;
import com.pointstar.dp.modules.sys.controller.AbstractController;
import com.pointstar.dp.common.entity.Page;
import com.pointstar.dp.common.entity.R;
import com.pointstar.dp.modules.project.entity.ProjectRecordEntity;
import com.pointstar.dp.modules.project.service.ProjectRecordService;

/**
 * 项目记录表
 * @author pointstar<admin@pointstar.com>
 */
@RestController
@RequestMapping("/project/record")
public class ProjectRecordController extends AbstractController {
	
	@Autowired
	private ProjectRecordService projectRecordService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<ProjectRecordEntity> list(@RequestBody Map<String, Object> params) {
		return projectRecordService.listProjectRecord(params);
	}
		
	/**
	 * 新增
	 * @param projectRecord
	 * @return
	 */
	@SysLog("新增项目记录表")
	@RequestMapping("/save")
	public R save(@RequestBody ProjectRecordEntity projectRecord) {
		return projectRecordService.saveProjectRecord(projectRecord);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody Long id) {
		return projectRecordService.getProjectRecordById(id);
	}
	
	/**
	 * 修改
	 * @param projectRecord
	 * @return
	 */
	@SysLog("修改项目记录表")
	@RequestMapping("/update")
	public R update(@RequestBody ProjectRecordEntity projectRecord) {
		return projectRecordService.updateProjectRecord(projectRecord);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除项目记录表")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody Long[] id) {
		return projectRecordService.batchRemove(id);
	}
	
}
